package com.wlj.web.aspect;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

@Aspect
@Component
public class TimeAspect {

    private Logger logger= LoggerFactory.getLogger(getClass());

    @Around("execution(* com.wlj.web.controller.UserController.*(..))")
    public Object HandleControllerMethod(ProceedingJoinPoint pjp) throws Throwable {

        //方法参数
        Object[] args = pjp.getArgs();
        for (Object arg : args) {
            logger.info("传进来的方法参数:{}",arg);
        }

        Object result = pjp.proceed();
        return result;
    }



    //restful api拦截顺序:  filter->interceptor->controllerAdvice(有异常时)->aspect->controller
}
